import React from "react";
import PropTypes from "prop-types";
import "./style.css";

const SvgIcon = props => {
  const { iconName, color } = props;
  return (
    <i aria-hidden="true">
      <svg className="svg-icon">
        <use xlinkHref={"#icon-" + iconName} fill={color} />
      </svg>
    </i>
  );
};

SvgIcon.propTypes = {
  iconName: PropTypes.string.isRequired,
  color: PropTypes.string
};

SvgIcon.defaultProps = {
  color: "currentColor"
};

export default SvgIcon;
